import request from '@/utils/axios'

export const userRegister = (data: {
  "invite_code"?: string; // 推荐码
  "user_name": string;
  "password": string;
  "confirm_password": string;
}) => {
  return request.post({ url: '/api/v1/client', data })
}

export const userlLogin = (data: {
  "user_name": string;
  "password": string;
  "captcha_id": string;
  "captcha_code": string;
}) => {
  return request.post({ url: '/api/v1/client/login', data })
}

// 获取登录验证码id
export const getLoginCaptchaId = () => {
  return request.get({ url: '/api/v1/client/login.captchaid' })
}

// 获取用户信息
export const getUserInfo = (params: any) => {
  return request.get({ url: '/api/v1/client',params })
}

export const updateUserInfo = (data: {
  "real_name": string;
  "gender": number;
  "birthday": string;
  "phone_number": string;
  "verify_code": string
  "avatar": string;
}) => {
  return request.put({ url: '/api/v1/client', data })
}

export const getCustomerLevel = () => {
  return request.get({ url: '/api/v1/client.level' })
}
// 发送短信验证码
export const sendSMSCode = (data: {
  "phone_number": string; // +区号
}) => {
  return request.post({ url: '/api/v1/auth/verification_code', data })
}

// 设置是否自动转入金额
// 0: 关闭，1：开启
export function editAntoTransferSetting(data: {"anto_transfer": number}) {
  return request.put({ url: '/api/v1/client.any', data})
}


// 获取用户推荐链接信息
export function getUserRecommendationPlan() {
  return request.get({ url: '/api/v1/client/referral.invitation' });
}